<template>
  <my-table
    class="element-top"
    ref="myTable"
    :row-key="(row, index) => row.id"
    :format-conditions="true"
    :bordered="true"
    :row-selection="rowSelection"
    :dataSource="dataSource"
    :columns="columns"
    :loading="loading"
    :pagination="pagination"
    :scroll="scroll"
    @search="handleSearch"
    @refresh="handleRefresh"
    @reset="handleReset"
    @change="handleTableChange"
    :customRow="customRow"
  >
    <!--扩展按钮-->
    <slot name="expandedRowRender"></slot>
    <template slot="logo" slot-scope="text">
      <img width="60" style="cursor: pointer" height="60" :src="text" />
    </template>

    <slot name="isHome"></slot>

    <template slot="status" slot-scope="text">
      <a-badge
        :status="text | statusTypeFilter"
        :text="text | statusTextFilter"
      />
    </template>

    <template
      slot-scope="text, record, index"
      :slot="slot"
      v-for="slot in scopedSlots"
    >
      <slot :name="slot" v-bind="{ text, record, index }"> </slot>
    </template>

    <!-- <span slot="action" slot-scope="text, item"> 因为advanceTable 也是用的解构，所以这里用解构-->
    <span slot="action" slot-scope="{ record }">
      <!-- <a-space> -->
        <a
          @click="handleDetail(record)"
          v-if="showDetail"
        >
          <a-icon type="eye" />详情
        </a>
        <a @click="handleEdit(record)" v-if="showEdit" >
          <a-icon type="edit" />修改
        </a>
        <a
          @click="handleDelete(record)"
          v-if="showRemove"
        >
          <a-icon type="delete" />删除
        </a>
        <slot name="buttons" :item="record"></slot>
      <!-- </a-space> -->
    </span>

    <template slot="title">
      <a-space>
        <a-button
          type="primary"
          icon="plus-circle"
          @click="handleAdd"
          v-if="showAdd"
          >添加</a-button
        >
        <a-button
          type="danger"
          icon="minus-circle"
          @click="handleBatchDelete"
          v-if="showRemove"
          >删除</a-button
        >
        <a-button
          type="dashed"
          icon="vertical-align-top"
          @click="handleImport"
          v-if="showImport"
          >导入</a-button
        >
        <a-button
          type="dashed"
          icon="vertical-align-bottom"
          @click="handleExport"
          v-if="showExport"
          >导出</a-button
        >
        <slot name="titleBtns"></slot>
      </a-space>
      <template v-if="!showAdd && !showRemove && !showImport && !showExport">
        {{ title }}
      </template>
    </template>
  </my-table>
</template>
<script>
import { myTableMixin } from "./myTable";
export default {
  mixins: [myTableMixin],
  computed: {
    scopedSlots() {
      return Object.keys(this.$scopedSlots).filter(
        (slot) => slot !== "expandedRowRender" && slot !== "title"
      );
    },
  },
  data() {
    return {};
  },
  created() {
    if (!this.hasSelect) {
      this.rowSelection = null;
    }
  },
  mounted() {
    if (!this.showOnSelectAll && this.rowSelection) {
      delete this.rowSelection.onSelectAll;
    }
    if (!this.showOnRowSelected && this.rowSelection) {
      delete this.rowSelection.onSelect;
    }
  },
};
</script> 



 <!-- <a-popover placement="top">
1 index.vue created
2 mytable.js created
3 mytable.vue created
4 mytable.js mounted
5 mytable.vue mounted
6 index.vue mounted
            <template slot="content">刷新</template>
            <a-button
              class="element-right"
              @click="handleRefresh"
              :loading="loading"
              icon="sync"
            ></a-button>
          </a-popover> -->

         <!-- <template slot="tel" slot-scope="text">
      {{ text | telFilter }}
    </template> -->


    <!-- <template slot="registerStatus" slot-scope="text">
      <a-tag :color="text | registerStatusTypeFilter">{{ text | registerStatusTextFilter }}</a-tag>
    </template> -->
    
      <!-- <a :disabled="item.sort === 1" @click="handleUp(item)"> <a-icon type="arrow-up" />上移</a>
      <a style="margin-left: 5px" :disabled="item.sort === pagination.total" @click="handleDown(item)">
        <a-icon type="arrow-down" />下移</a
      > -->